let Fly = require('flyio/dist/npm/wx');
let fly = new Fly();

function checkStatus(res) {
  if (res.status === 200 || res.status === 304) {
    return res.data
  }
}

export default {
  get(url, params) {
    return fly.get(url, params).then(checkStatus);
  },
  post(url, params) {
    return fly.post(url, params,{
      headers:{
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    }).then(checkStatus);
  }
};